package com.geologyoa.persist;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.geologyoa.commons.JdbcUtil;
import com.geologyoa.domain.Dwqk01;
import com.geologyoa.domain.Dwzz01;
import com.geologyoa.domain.Wpfj01;

public class Wpfj01DaoImpl implements Wpfj01Dao {
	Connection conn = null;
	PreparedStatement ps = null;
	ResultSet rs = null;
	public Boolean AddWpfj(Wpfj01 wpfj01) {
		Boolean flag =false;
		   conn=JdbcUtil.getConnection();
		   String sql = "";
		  sql = "insert into wpfj01 values(oa_seq.nextval,?,?,?,null,?,null)";
			try {
				ps = conn.prepareStatement(sql);
				ps.setString(1, wpfj01.getWpfj0102());
				ps.setString(2, wpfj01.getWpfj0103());
				ps.setString(3, wpfj01.getWpfj0104());
				ps.setString(4, wpfj01.getWpfj0106());
	
				int number=ps.executeUpdate();
				if(number>0)
				{
					flag=true;
				}
				
			} catch (SQLException e) {
				e.printStackTrace();
			} finally
			{
				JdbcUtil.closeAll(ps,conn);
			}
			return flag;
	}
	public List<Wpfj01> SearchFillPathWpfj(String WPFJ0102, String WPFJ0104) {
		Wpfj01 wpfj01=null;
		List<Wpfj01> wpfj01List=new ArrayList<Wpfj01>();
		   conn=JdbcUtil.getConnection();
		   String sql = "";
		   sql = "select * from wpfj01 where WPFJ0102=? and WPFJ0104=?";
			try {
				ps = conn.prepareStatement(sql);
				ps.setString(1, WPFJ0102);
				ps.setString(2, WPFJ0104);
				rs=ps.executeQuery();
				while(rs.next())
				{
					wpfj01=new Wpfj01();
					wpfj01.setWpfj0106(rs.getString("wpfj0106"));
					wpfj01List.add(wpfj01);
				}
				
			} catch (SQLException e) {
				e.printStackTrace();
			} finally
			{
				JdbcUtil.closeAll(ps,conn);
			}
			return wpfj01List;
	}

}
